package my.st.web;

import my.st.service.segment.SegmentService;
import my.st.service.segment.StandardSegmentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Arrays;


@RestController
@RequestMapping("/segment")
public class StandardSegment {

    private static final Logger log = LoggerFactory.getLogger(StandardSegment.class);

    @Resource
    private StandardSegmentService StandardSegmentService;

    @Resource
    @Qualifier("jieba")
    private SegmentService jieba;

    @Resource
    @Qualifier("my")
    private SegmentService my;

    @PostMapping("/jieba")
    public String jiebaSeg(String names){
        return StandardSegmentService.doStandardNameSeg(Arrays.asList(names.split("\r\n")),jieba);
    }

    @PostMapping("/my")
    public String mySeg(String names){
        return StandardSegmentService.doStandardNameSeg(Arrays.asList(names.split("\r\n")),my);
    }
}
